package algoWing42.controlador;

import java.awt.event.KeyEvent;
import algoWing42.modelo.AvionJugador;
import titiritero.KeyPressedObservador;

public class EscuchadorDeKeyPress implements KeyPressedObservador {

	private AvionJugador avion;
	
	public EscuchadorDeKeyPress(AvionJugador unAvion){
		this.avion = unAvion;
	}
	
	public void keyPressed(KeyEvent event) {
		switch (event.getKeyCode()) {
		case KeyEvent.VK_DOWN:
			avion.moverEnY(5);
			break;
			
		case KeyEvent.VK_LEFT:
			avion.moverEnX(-5);
			break;
			
		case KeyEvent.VK_UP:
			avion.moverEnY(-5);
			break;
		
		case KeyEvent.VK_RIGHT:
			avion.moverEnX(5);
			break;
			
		case KeyEvent.VK_Z:
			avion.dispararLaser();
			break;
		case KeyEvent.VK_X:
			avion.dispararCohete();
			break;
		case KeyEvent.VK_C:
			avion.dispararTorpedo();
			break;

		default:
			break;
		}
	}

}
